package aux;

/**
 *
 * @author Yan Couto
 * @version 1.0
 */
public class Extra {
    protected Extra () { throw new AssertionError(); }
    
    public static String toOneString(String[] s,String divisor) {
        String aux = "";
        for(String a:s)
            aux+=a + divisor;
        return aux;
    }
    
    public static String[] toStringArray(Object[] array) {
        String[] a = new String[array.length];
        for(int i=0;i<a.length;i++)
            a[i] = array[i].toString();
        return a;
    }
    
    public static String encrypt(String s) {
        char[] c = s.toCharArray();
        for(int i=0;i<c.length;i++) {
            int cc = c[i];
            c[i] = (char) ((cc*2)-1);
        }
        return new String(c);
    }
    
    public static String decrypt(String s) {
        char[] c = s.toCharArray();
        for(int i=0;i<c.length;i++){
            int cc = c[i];
            cc = ++cc/2;
            c[i] = ((char) cc);
        }
        return new String(c);
    }
    
    public static void decryptAll(String[] s) {
        for(int i=0;i<s.length;i++)
            s[i] = decrypt(s[i]);
    }
}
